package design.factory.factoryMethod;

public class MachineGunFactory implements GunFactory {
    @Override
    public Gun getGun() {
        return new MachineGun();
    }
    private MachineGunFactory() {}
    private static volatile MachineGunFactory mf = null;
    public static MachineGunFactory getFactory() {
        if(mf == null) {
            synchronized (MachineGunFactory.class) {
                if(mf == null) {
                    mf = new MachineGunFactory();
                }
            }
        }
        return mf;
    }
}
